//
//  NSArray+GZJsonValue.m
//  GZJsonValue
//
//  Created by GR on 2019/1/8.
//  Copyright © 2019 GR. All rights reserved.
//

#import "NSArray+GZJsonValue.h"
#import "GZJsonValue.h"
#import <objc/runtime.h>

@implementation NSObject (GZJosnValue)

- (GZJsonValue *)json {
    return nil;
}

@end

@implementation NSArray (GZJsonValue)

- (GZJsonValue *)json {
    GZJsonValue *value = objc_getAssociatedObject(self, "gztool.jsonvalue.json");
    if (value) {
        return value;
    }
    
    value = [GZJsonValue valueWithObject:self];
    objc_setAssociatedObject(self, "gztool.jsonvalue.json", value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    
    return value;
}

@end
